﻿Imports System.Data

Partial Class Reportes_Demanda
    Inherits System.Web.UI.Page
    Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
        If Not Page.IsPostBack Then
            Call Populate_YearList()
        End If
    End Sub

    Sub Populate_YearList()
        Dim intYear As Integer

        'Year list can be changed by changing the lower and upper 
        'limits of the For statement    
        For intYear = DateTime.Now.Year - 20 To DateTime.Now.Year + 20
            DropDownList1.Items.Add(intYear.ToString())
        Next

        'Make the current year selected item in the list
        DropDownList1.Items.FindByValue(DateTime.Now.Year.ToString()).Selected = True
    End Sub

    Protected Sub aceptar_Click(sender As Object, e As EventArgs) Handles aceptar.Click
        Dim dvSql As DataView = DirectCast(SqlDataSource1.Select(DataSourceSelectArguments.Empty), DataView)

        txtMayorDemanda.Text = dvSql.ToTable.Rows(0)(0).ToString()
    End Sub
End Class
